#ifndef NCOMBOBOX_H
#define NCOMBOBOX_H
#include "solar/trunk/NinsipidView.h"
#include "solar/trunk/NListWidget.h"
#include "solar/trunk/NTitleBar.h"
#include "solar/trunk/NSurveyor.h"
class NcomboBox : public QWidget{

    Q_OBJECT

public:
    explicit NcomboBox(QWidget *parent=nullptr);

    ~NcomboBox();

    void setVisible(bool vsb);

    void d_radius(int radius);

    void d_filler(QList<QColor> color);

    void d_filler(QColor color);

    void d_filler(QString color);

    void d_background(QString curtain);

    void d_filler_on(NTitleBar::FillerType type, bool enable);

    void d_filler_del(NTitleBar::FillerType type);

    void d_leftico_pix(QString sharp, QString lowkey);

    void d_rightico_pix(QString nor_lowkey, QString nor_sharp, QString unor_lowkey, QString unor_sharp);

    QListWidget* g_stall();

    QLineEdit* g_linedit();

    void d_font(QFont font);

    void d_linecolor(QColor color);

    void d_linebackground(QColor color);

    NinsipidView *ico(NT::LOCALTION how);

    void ico_r_pree();

    void ico_r_keep();

private:
    QColor backups_mask;
    QHBoxLayout *bx_lyout = new QHBoxLayout(this);
    NinsipidView *bx_lIco = new NinsipidView();
    QLineEdit *bx_line = new QLineEdit(this);
    NinsipidView *bx_rIco = new NinsipidView();
    NScrollBar *vscroll = new NScrollBar(this, NT::ORIEN_VERTICAL);
    NScrollBar *hscroll = new NScrollBar(this, NT::ORIEN_HORIZONTAL);
    NListWidget *bx_stall = new NListWidget(nullptr, true);
    QMap<QString, int> impact_int;
    QMap<QString, QString> impact_pixmap;
    QList<QColor> impact_stcolor;
    QMap<QString, bool> impact_bool;
    QMap<NTitleBar::FillerType,  bool> impact_ftype;

    QString lineditStyle = "QLineEdit{"
                           "font:15px;"
                           "border-radius:2px;"
                           "color:rgba(92,92,92,233);"
                           "background-color:rgb(251,252,253);"
                           "border:1px;}";



    QString listwidStyle = "QListWidget{"
                           "border:1px rgb(222,225,232);"
                           "outline:none;"
                           "background-color:rgb(239,239,250);"
                           "color:rgb(120,120,120);"
                           "font:12px;}"

                           "QListWidget:item{"
                           "color:rgb(125, 128, 125);"
                           "text-align:left;"
                           "border-radius:8px;"
                           "height:30px;}"

                           "QListWidget::item:selected{"
                           "background-color:rgb(125, 128, 223);"
                           "color:rgb(242,241,247);"
                           "outline:none;"
                           "border:0px;"
                           "padding:1px 1px 1px 2px;"
                           "border-style:outset;}"

                           "QScrollBar:vertical{"
                           "width:20px;"
                           "background-color:transparent;"
                           "border-color:rgb(155,186,200);"
                           "margin-left:0px;"
                           "margin-right:0px;}"

                           "QScrollBar:horizontal{"
                           "height:20px;"
                           "background-color:transparent;"
                           "border-color:Lavender;"
                           "margin-top:0px;}"

                           "QScrollBar:hover{"
                           "background-color:rgb(155,186,200);}";

    void paintEvent(QPaintEvent *event);

    void enterEvent(QEnterEvent *event);

    void leaveEvent(QEvent *event);

    void resizeEvent(QResizeEvent *event);

    void ico_r_touch(bool enter);

    void ico_l_touch(bool enter);

    void extra_stall();

    void stall_invisible();

    void list_selected();

    void tab_vscrollvalue_change(double value){
        int rowc = bx_stall->count();
        if (vscroll->maxHpower() != (double)rowc) vscroll->setMaxHpower(rowc);
        int scrollmax = vscroll->maximum();
        int indexof = (rowc - 1) * (value / scrollmax);
        QModelIndex tablindex = bx_stall->model()->index(indexof, 0);
        bx_stall->scrollTo(tablindex, QAbstractItemView::PositionAtCenter);
    }

    void tab_hscrollvalue_change(double value){
        double expectnum = bx_stall->getMaxlenght().first / bx_stall->width();
        if (hscroll->maxHpower() != expectnum) hscroll->setMaxHpower(expectnum);
        P_LideleGate *itemdelegate = bx_stall->itemDelegate();
        itemdelegate->setExcursion(value);
        bx_stall->viewport()->update();
    }

signals:
    void msev_match_pre();
};

#endif // NCOMBObx_H
